package com.htc.android.footprints.activity;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.location.Address;
import android.location.Location;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.TouchDelegate;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.htc.android.footprints.ILocationAgentCallback;
import com.htc.android.footprints.ILocationAgentService;
import com.htc.android.footprints.commonui.HtcDialog;
import com.htc.android.footprints.provider.FootprintManager;
import com.htc.android.footprints.service.LocationAgentService;
import com.htc.android.footprints.utils.FootprintUtils;
import com.htc.android.footprints.utils.SettingInfo;
import com.htc.android.footprints.utils.StorageUtil;
import com.htc.android.footprints.utils.TitleGenerator;
import com.htc.android.footprints.utils.camera.FootprintImageManager;
import com.htc.android.footprints.view.MediaControlPanelEditMode;
import com.htc.android.footprints.vo.Category;
import com.htc.android.footprints.vo.Footprint;

public class FootprintDetailEditActivity extends MapActivity implements
		View.OnClickListener {
	private static final int CHOOSE_PHOTO_DIALOG = 10;
	private static final int DELETE_FOOTPRINT_DIALOG = 15;
	private static final int FIRST_RETRIEVE_ADDRESS_DIALOG = 13;
	private static final int HANDLE_DISMISS_PROGRESS_DIALOG = 101;
	private static final int HANDLE_FIRST_RETRIEVE_ADDRESS = 103;
	private static final int HANDLE_GEOCODER_BY_GPS = 102;
	private static final int HANDLE_UPDATE_ADDRESS = 100;
	public static final String IMAGE_UNSPECIFIED = "image/*";
	private static final int LOCATION_PICKER_NOT_FOUND_DIALOG = 16;
	private static final int LOCATION_SOURCE_DISABLED_DIALOG = 18;
	private static final int MENU_ALL_FOOTPRINTS = 0;
	private static final int MENU_DELETE = 1;
	private static final int PHOTO_PICKER_NOT_FOUND_DIALOG = 17;
	private static final int PROGRESS_DIALOG = 14;
	private static final int REQUEST_CHOOSE_PHOTO = 2;
	private static final int REQUEST_EDIT_LOCATION = 5;
	private static final int REQUEST_PHOTO_PICKED_WITH_DATA = 4;
	private static final int REQUEST_RECAPTURE = 3;
	private static final int RESULT_LOCATION_PICKER = 1;
	private static final int SELECT_CATEGORY_DIALOG = 11;
	private static final int SELECT_LOCATION_DIALOG = 12;
	private static final int SERVICE_BINDED = 2;
	private static final int SERVICE_BINDING = 1;
	private static final int SERVICE_UNBIND = 0;
	private static final String TAG = "FootprintDetailEditActivity";
	private static final int WIRELESS_DISABLED_DIALOG = 19;
	private TextView addressText;
	private ArrayList<Category> categories;
	private Button categoryButton;
	private int categoryIndex;
	private String[] categoryNames;
	private TextView connectionFailedText = null;
	DialogInterface.OnKeyListener dlgKeyListener = new DialogInterface.OnKeyListener() {
		public boolean onKey(DialogInterface paramDialogInterface,
				int paramInt, KeyEvent paramKeyEvent) {
			if ((paramDialogInterface == FootprintDetailEditActivity.this.progressDialog)
					&& (paramInt == 4)) {
				Log.i("FootprintDetailEditActivity", "keyCode = KEYCODE_BACK");
				TitleGenerator.getInstance(FootprintDetailEditActivity.this)
						.stopTitleSearch();
				FootprintDetailEditActivity.this.progressDialog.cancel();
			}
			for (int i = 1;; i = 0) {
				return i;
				if ((paramDialogInterface != FootprintDetailEditActivity.this.mListDialog)
						|| (paramInt != 4))
					continue;
				Log.i("FootprintDetailEditActivity", "dialog back key");
				FootprintDetailEditActivity.this.locationText
						.setText(2131361852);
			}
		}
	};
	private boolean gpsEnabled;
	private boolean gpsUpdateRequired = false;
	private boolean isDelete = false;
	private boolean isPickerRunning = false;
	private boolean isRecaptureRunning = false;
	private TextView locationText;
	private ImageView mBalloonView;
	private int mBindState = 0;
	private int mCacheLat = 0;
	private int mCacheLog = 0;
	private String mCachePhotoName;
	private ILocationAgentCallback mCallback = new ILocationAgentCallback.Stub() {
		public void onAgentPause() throws RemoteException {
		}

		public void onUpdateStatus(int paramInt1, int paramInt2,
				double paramDouble1, double paramDouble2)
				throws RemoteException {
			switch (paramInt1) {
			default:
			case 10:
			case 11:
			case 13:
			case 14:
			case 12:
			}
			while (true) {
				return;
				FootprintDetailEditActivity.this.locationText
						.setText(2131361852);
				Log.i("FootprintDetailEditActivity",
						"onUpdateStatus : INDICATOR_STOP");
				continue;
				FootprintDetailEditActivity.this.locationText
						.setText(2131361853);
				continue;
				FootprintDetailEditActivity.this.mFootprint.mLatitude = (int) (paramDouble1 * 1000000.0D);
				FootprintDetailEditActivity.this.mFootprint.mLongitude = (int) (paramDouble2 * 1000000.0D);
				FootprintDetailEditActivity.this.mFootprint
						.setAccuracyByProvider("gps");
				FootprintDetailEditActivity.this.locationText
						.setText(2131361852);
				FootprintDetailEditActivity.this.mTextLatLon
						.setText(FootprintUtils
								.getFormatedLat(FootprintDetailEditActivity.this.mFootprint.mLatitude)
								+ ", "
								+ FootprintUtils
										.getFormatedLon(FootprintDetailEditActivity.this.mFootprint.mLongitude));
				FootprintDetailEditActivity.this.mGpsUpdate.setEnabled(true);
				FootprintDetailEditActivity.this.moveMapCenterToCurrent();
				FootprintDetailEditActivity.this.mService
						.stopTrackingWithoutNotify();
				FootprintDetailEditActivity.this.getWindow().clearFlags(128);
				if (FootprintDetailEditActivity.this.mListDialog != null)
					FootprintDetailEditActivity.this.mListDialog.dismiss();
				if (FootprintDetailEditActivity.this.mFixLocation == null)
					FootprintDetailEditActivity.access$1002(
							FootprintDetailEditActivity.this, new Location(
									"gps"));
				FootprintDetailEditActivity.this.mFixLocation
						.setLatitude(paramDouble1);
				FootprintDetailEditActivity.this.mFixLocation
						.setLongitude(paramDouble2);
				FootprintDetailEditActivity.this.mHandler
						.sendEmptyMessageDelayed(102, 300L);
				Log.i("FootprintDetailEditActivity",
						"onUpdateStatus : INDICATOR_FIX_GPS");
				continue;
				if (FootprintDetailEditActivity.this.mFixNetwork == null) {
					FootprintDetailEditActivity.access$2302(
							FootprintDetailEditActivity.this, new Location(
									"network"));
					FootprintDetailEditActivity.this.mFixNetwork
							.setLatitude(paramDouble1);
					FootprintDetailEditActivity.this.mFixNetwork
							.setLongitude(paramDouble2);
				}
				while (true) {
					Log.i("FootprintDetailEditActivity",
							"onUpdateStatus : INDICATOR_FIX_NETWORK");
					break;
					FootprintDetailEditActivity.this.mFixNetwork
							.setLatitude(paramDouble1);
					FootprintDetailEditActivity.this.mFixNetwork
							.setLongitude(paramDouble2);
				}
				if (FootprintDetailEditActivity.this.gpsEnabled)
					FootprintDetailEditActivity.this.showDialog(12);
				Log.i("FootprintDetailEditActivity",
						"onUpdateStatus : INDICATOR_TIMEOUT");
			}
		}
	};
	private View.OnClickListener mChoosePhotoCb = new View.OnClickListener() {
		public void onClick(View paramView) {
			if (!FootprintUtils
					.isStorageEnough(FootprintDetailEditActivity.this))
				;
			while (true) {
				return;
				FootprintDetailEditActivity.this.showDialog(10);
			}
		}
	};
	private ServiceConnection mConnection = new ServiceConnection() {
		public void onServiceConnected(ComponentName paramComponentName,
				IBinder paramIBinder) {
			Log.i("FootprintDetailEditActivity",
					"onServiceConnected. mBindState = SERVICE_BINDED");
			FootprintDetailEditActivity.this.mService = ILocationAgentService.Stub
					.asInterface(paramIBinder);
			FootprintDetailEditActivity.access$2802(
					FootprintDetailEditActivity.this, 2);
			try {
				Log.d("FootprintDetailEditActivity",
						"mService.resume() at onServiceConnected");
				FootprintDetailEditActivity.this.mService.resume();
				FootprintDetailEditActivity.this.mService
						.registerCallback(FootprintDetailEditActivity.this.mCallback);
				if (FootprintDetailEditActivity.this.mService.isTracking()) {
					FootprintDetailEditActivity.this.mGpsUpdate
							.setEnabled(false);
					FootprintDetailEditActivity.this.getWindow().addFlags(128);
				} else if (FootprintDetailEditActivity.this.gpsUpdateRequired) {
					FootprintDetailEditActivity.this.mGpsUpdate
							.setEnabled(false);
					FootprintDetailEditActivity.this.mService
							.enableMyLocation();
					FootprintDetailEditActivity.this.getWindow().addFlags(128);
					FootprintDetailEditActivity.access$2602(
							FootprintDetailEditActivity.this, false);
				}
			} catch (RemoteException localRemoteException) {
				localRemoteException.printStackTrace();
			}
		}

		public void onServiceDisconnected(ComponentName paramComponentName) {
			Log.d("FootprintDetailEditActivity",
					"onServiceDisconnected. mBindState = SERVICE_UNBIND");
			FootprintDetailEditActivity.access$2802(
					FootprintDetailEditActivity.this, 0);
		}
	};
	private Context mContext;
	private Location mFixLocation;
	private Location mFixNetwork = null;
	private Footprint mFootprint;
	private ImageView mGpsUpdate;
	private final Handler mHandler = new Handler() {
		public void handleMessage(Message paramMessage) {
			switch (paramMessage.what) {
			default:
			case 101:
			case 100:
			case 102:
			case 103:
			}
			while (true) {
				return;
				if (FootprintDetailEditActivity.this.progressDialog == null)
					continue;
				FootprintDetailEditActivity.this.progressDialog.dismiss();
				continue;
				FootprintDetailEditActivity.this.addressText
						.setText(FootprintDetailEditActivity.this.mFootprint.mAddr);
				continue;
				FootprintDetailEditActivity.this
						.geocoderTitle(FootprintDetailEditActivity.this.mFixLocation);
				continue;
				SettingInfo localSettingInfo = SettingInfo
						.getInstance(FootprintDetailEditActivity.this);
				if (!localSettingInfo.isFirstRetrieveAddress())
					continue;
				FootprintDetailEditActivity.this.showDialog(13);
				localSettingInfo.setFirstRetrieveAddress(false);
			}
		}
	};
	private boolean mIsSaved = false;
	private HtcAlertDialog mListDialog = null;
	private MapView mMap;
	View.OnClickListener mMapButton = new View.OnClickListener() {
		public void onClick(View paramView) {
			Intent localIntent = new Intent("com.htc.android.locationpicker");
			localIntent.putExtra("PickerIcon",
					((BitmapDrawable) FootprintDetailEditActivity.this
							.getResources().getDrawable(2130837655))
							.getBitmap());
			if ((FootprintDetailEditActivity.this.mFootprint.mLatitude == 0)
					&& (FootprintDetailEditActivity.this.mFootprint.mLongitude == 0))
				localIntent.putExtra("InputLocation", 4);
			while (true) {
				localIntent.putExtra("PickerMode", 1);
				localIntent.putExtra("PickerPanelStyle", 8);
				localIntent.putExtra("PickerHintFlag", 5);
				localIntent.putExtra("PickerHintMsg",
						FootprintDetailEditActivity.this.mFootprint.mName);
				localIntent.putExtra("PickerReturnType", 9);
				localIntent
						.putExtra(
								"PickerAlertConnectionFailed",
								SettingInfo
										.getInstance(FootprintDetailEditActivity.this).showConnectionFailedAlert);
				FootprintDetailEditActivity.this.locationText
						.setText(2131361852);
				try {
					if (FootprintDetailEditActivity.this.mService != null)
						FootprintDetailEditActivity.this.mService
								.setTimeoutNotify(false);
				} catch (RemoteException localRemoteException) {
					try {
						while (true) {
							FootprintDetailEditActivity.access$1702(
									FootprintDetailEditActivity.this, true);
							FootprintDetailEditActivity.this
									.startActivityForResult(localIntent, 1);
							return;
							localIntent
									.putExtra(
											"PickerLatitude",
											FootprintDetailEditActivity.this.mFootprint.mLatitude / 1000000.0D);
							localIntent
									.putExtra(
											"PickerLongitude",
											FootprintDetailEditActivity.this.mFootprint.mLongitude / 1000000.0D);
							localIntent.putExtra("InputLocation", 3);
							break;
							localRemoteException = localRemoteException;
							localRemoteException.printStackTrace();
						}
					} catch (ActivityNotFoundException localActivityNotFoundException) {
						while (true)
							FootprintDetailEditActivity.this.showDialog(16);
					}
				}
			}
		}
	};
	private MediaControlPanelEditMode mMediaPanel;
	private Bitmap mPhotoBitmap = null;
	private View.OnClickListener mSelectCategoryListener = new View.OnClickListener() {
		public void onClick(View paramView) {
			FootprintDetailEditActivity.this.showDialog(11);
		}
	};
	ILocationAgentService mService;
	private StorageUtil mStorageUtil;
	private TextView mTextLatLon;
	private boolean networkConnected;
	private View.OnClickListener onGpsUpdateClickListenerDoUpdate = new View.OnClickListener() {
		public void onClick(View paramView) {
			try {
				FootprintDetailEditActivity.this.mGpsUpdate.setEnabled(false);
				FootprintDetailEditActivity.this.mService.enableMyLocation();
				FootprintDetailEditActivity.this.getWindow().addFlags(128);
				return;
			} catch (RemoteException localRemoteException) {
				while (true)
					localRemoteException.printStackTrace();
			}
		}
	};
	private View.OnClickListener onGpsUpdateClickListenerShowAlert = new View.OnClickListener() {
		public void onClick(View paramView) {
			FootprintDetailEditActivity.this.showDialog(18);
		}
	};
	private View.OnClickListener onTextLatLonClickListener = new View.OnClickListener() {
		public void onClick(View paramView) {
			FootprintDetailEditActivity.this.getWindow().clearFlags(128);
			FootprintDetailEditActivity.this.locationText.setText(2131361852);
			FootprintDetailEditActivity.this.mGpsUpdate.setEnabled(true);
			try {
				if (FootprintDetailEditActivity.this.mService != null)
					FootprintDetailEditActivity.this.mService
							.stopTrackingWithoutNotify();
				Intent localIntent = new Intent(
						FootprintDetailEditActivity.this,
						EditLocationActivity.class);
				localIntent.putExtra("LATITUDE",
						FootprintDetailEditActivity.this.mFootprint.mLatitude);
				localIntent.putExtra("LONGITUDE",
						FootprintDetailEditActivity.this.mFootprint.mLongitude);
				FootprintDetailEditActivity.this.startActivityForResult(
						localIntent, 5);
				return;
			} catch (RemoteException localRemoteException) {
				while (true)
					localRemoteException.printStackTrace();
			}
		}
	};
	private TextView phoneText;
	private ImageView photoView;
	private ProgressDialog progressDialog;
	private RatingBar rating;
	private View saveButton;
	private TextView textCreateDate;
	private TextView textCreateTime;
	private TextView textNote;
	private EditText titleText;
	private TextView webText;

	private void bindLocationAgentService() {
		Log.i("FootprintDetailEditActivity",
				"bind LocationAgentService. mBindState = SERVICE_BINDING");
		this.mBindState = 1;
		Intent localIntent = new Intent();
		localIntent.setClass(this, LocationAgentService.class);
		bindService(localIntent, this.mConnection, 1);
	}

	private boolean checkWirelessNetwork() {
		int i = 0;
		ConnectivityManager localConnectivityManager = (ConnectivityManager) getSystemService("connectivity");
		if (localConnectivityManager != null) {
			NetworkInfo localNetworkInfo = localConnectivityManager
					.getActiveNetworkInfo();
			if ((localNetworkInfo != null)
					&& (localNetworkInfo.getState() == NetworkInfo.State.CONNECTED))
				i = 1;
		}
		return i;
	}

	private void doPickPhotoAction() {
		Intent localIntent = new Intent(
				"com.htc.HTCAlbum.action.ITEM_PICKER_FROM_COLLECTIONS", null);
		localIntent.setType("image/*");
		localIntent.putExtra("crop", "true");
		localIntent.putExtra("aspectX", 1);
		localIntent.putExtra("aspectY", 1);
		localIntent.putExtra("outputX", 400);
		localIntent.putExtra("outputY", 400);
		try {
			localIntent.putExtra("return-data", true);
			startActivityForResult(localIntent, 2);
			return;
		} catch (ActivityNotFoundException localActivityNotFoundException) {
			while (true)
				showDialog(17);
		}
	}

	private void geocoderTitle(Location paramLocation) {
		String str = paramLocation.getProvider();
		SettingInfo localSettingInfo = SettingInfo.getInstance(this);
		if ((str.equalsIgnoreCase("gps")) || (str.equalsIgnoreCase("map"))) {
			Log.d("FootprintDetailEditActivity", "geocoderTitle by using GPS");
			if (localSettingInfo.retrieveAddress)
				showDialog(14);
		}
		while (true) {
			TitleGenerator.getInstance(this).getTitleFromNetwork(paramLocation,
					new TitleGenerator.SearchListener(localSettingInfo) {
						public void onResult(boolean paramBoolean1,
								String paramString1, String paramString2,
								Address paramAddress, boolean paramBoolean2) {
							FootprintDetailEditActivity.this.mHandler
									.sendEmptyMessage(101);
							if (!paramBoolean1)
								;
							while (true) {
								return;
								if ((paramBoolean2)
										&& (this.val$setting.retrieveAddress)) {
									FootprintDetailEditActivity.this.mHandler
											.sendEmptyMessage(103);
									FootprintDetailEditActivity.this.mFootprint.mAddr = paramString2;
									String str1 = paramAddress.getPhone();
									if (str1 != null)
										FootprintDetailEditActivity.this.mFootprint.mTel = str1;
									String str2 = paramAddress.getUrl();
									if (str2 != null)
										FootprintDetailEditActivity.this.mFootprint.mSite = str2;
								}
								FootprintDetailEditActivity.this.mHandler
										.sendEmptyMessage(100);
							}
						}
					});
			return;
			Log.d("FootprintDetailEditActivity",
					"geocoderTitle by using network");
		}
	}

	private String getOriginalCategoryNameAndRecordIndex(String paramString) {
		String str = getString(2131361965);
		ArrayList localArrayList = this.categories;
		int i = localArrayList.size();
		for (int j = 0;; j++) {
			if (j < i) {
				Category localCategory = (Category) localArrayList.get(j);
				if (!paramString.equals(localCategory.mKeyword))
					continue;
				str = localCategory.mName;
				this.categoryIndex = j;
			}
			return str;
		}
	}

	private void initCategoryData() {
		ArrayList localArrayList = FootprintManager.getInstance(this)
				.getAllCategory();
		int i = localArrayList.size();
		this.categoryNames = new String[i];
		for (int j = 0; j < i; j++)
			this.categoryNames[j] = ((Category) localArrayList.get(j)).mName;
		this.categories = localArrayList;
	}

	private void innerUnbindLocationAgentService(boolean paramBoolean) {
		try {
			if (this.mService != null) {
				Log.d("FootprintDetailEditActivity", "removeCallback");
				this.mService.removeCallback(this.mCallback);
				if (paramBoolean)
					this.mService.shutdownAgent();
			}
			unbindService(this.mConnection);
			this.mService = null;
			this.mBindState = 0;
			return;
		} catch (RemoteException localRemoteException) {
			while (true)
				localRemoteException.printStackTrace();
		}
	}

	private boolean isSetasFootprints(Intent paramIntent) {
		if ((paramIntent == null) || (paramIntent.getAction() == null))
			;
		for (boolean bool = false;; bool = paramIntent.getAction()
				.equalsIgnoreCase("com.htc.android.setasFootprint"))
			return bool;
	}

	private void moveMapCenterToCurrent() {
		this.locationText.setText(2131361852);
		GeoPoint localGeoPoint = new GeoPoint(this.mFootprint.mLatitude,
				this.mFootprint.mLongitude);
		this.mMap.getController().animateTo(localGeoPoint);
		this.mMap.getController().setZoom(this.mMap.getMaxZoomLevel());
		showBalloon();
	}

	private void openMapView() {
		LinearLayout localLinearLayout = (LinearLayout) findViewById(2131492934);
		ImageButton localImageButton = (ImageButton) getLayoutInflater()
				.inflate(2130903044, null);
		localImageButton.setOnClickListener(this.mMapButton);
		localImageButton.setBackgroundResource(2130837542);
		localImageButton.setImageResource(2130837676);
		localImageButton.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
		this.mMap.addView(
				localImageButton,
				new MapView.LayoutParams(getResources().getDimensionPixelSize(
						2131296273), getResources().getDimensionPixelSize(
						2131296272), this.mMap.getWidth() - 5, this.mMap
						.getHeight() - 5, 85));
		localLinearLayout.setTouchDelegate(new TouchDelegate(new Rect(0, 0,
				320, 260), localImageButton));
		if ((!SettingInfo.getInstance(this).showConnectionFailedAlert)
				&& (!this.networkConnected)
				&& (this.connectionFailedText == null)) {
			this.connectionFailedText = new TextView(this);
			this.connectionFailedText.setText(2131361937);
			this.connectionFailedText.setTextColor(-13421773);
			this.connectionFailedText.setPadding(10, 5, 10, 5);
			this.mMap.addView(this.connectionFailedText,
					new MapView.LayoutParams(-1, -2, 0, 0, 51));
		}
	}

	private void removeQueuedMessages() {
		this.mHandler.removeMessages(101);
		this.mHandler.removeMessages(100);
		this.mHandler.removeMessages(102);
		this.mHandler.removeMessages(103);
	}

	private void saveFootprint() {
		if (this.mIsSaved)
			;
		while (true) {
			return;
			if (this.mPhotoBitmap != null) {
				String str = String.valueOf(System.currentTimeMillis());
				FootprintImageManager.getInstance().forceWriteToFile(
						getContentResolver(), this.mPhotoBitmap, str + ".jpg");
				this.mFootprint.mPicPath = (FootprintImageManager
						.getDirectory() + File.separator + str + ".jpg");
				this.mFootprint.mPicFileName = (str + ".jpg");
			}
			populateToFootprint();
			this.mMediaPanel.stopMediaControlPanel();
			FootprintManager.getInstance(getApplicationContext()).addFootprint(
					this.mFootprint);
			this.mPhotoBitmap = null;
			if (!isSetasFootprints(getIntent()))
				new Thread() {
					public void run() {
						try {
							Thread.sleep(10L);
							if ((FootprintDetailEditActivity.this.mCacheLat != FootprintDetailEditActivity.this.mFootprint.mLatitude)
									|| (FootprintDetailEditActivity.this.mCacheLog != FootprintDetailEditActivity.this.mFootprint.mLongitude)
									|| (!FootprintDetailEditActivity.this.mCachePhotoName
											.equalsIgnoreCase(FootprintDetailEditActivity.this.mFootprint.mPicFileName)))
								FootprintUtils
										.setLocationToPicture(FootprintDetailEditActivity.this.mFootprint);
							return;
						} catch (InterruptedException localInterruptedException) {
							while (true)
								localInterruptedException.printStackTrace();
						}
					}
				}.start();
			this.mIsSaved = true;
		}
	}

	private void selectMediaByType(Context paramContext, int paramInt,
			String paramString) {
		if ((paramContext instanceof Activity)) {
			Intent localIntent1 = new Intent(
					"android.intent.action.GET_CONTENT");
			localIntent1.setType(paramString);
			Intent localIntent2 = Intent.createChooser(localIntent1,
					"choose photo");
			((Activity) paramContext).startActivityForResult(localIntent2,
					paramInt);
		}
	}

	private Footprint setAsFootprint(Intent paramIntent) {
		if (paramIntent == null)
			;
		Footprint localFootprint;
		for (Object localObject = null;; localObject = localFootprint) {
			return localObject;
			String str = String.valueOf(System.currentTimeMillis());
			Bundle localBundle = paramIntent.getExtras();
			this.mPhotoBitmap = ((Bitmap) localBundle.getParcelable("data"));
			localFootprint = new Footprint();
			localFootprint.mName = localBundle.getString("filename");
			int i = localFootprint.mName.indexOf(".jpg");
			if (i > 0)
				localFootprint.mName = localFootprint.mName.substring(0, i);
			if ((localFootprint.mName == null)
					|| (localFootprint.mName.length() == 0))
				localFootprint.mName = str;
			localFootprint.mCreateTime = Long.valueOf(str).longValue();
			localFootprint.mCategory = "favorite";
			localFootprint.mRate = 3;
			localFootprint.mLatitude = FootprintUtils
					.convertRationalLatLonToInt(
							localBundle.getString("GPSLatitude"),
							localBundle.getString("GPSLatitudeRef"));
			localFootprint.mLongitude = FootprintUtils
					.convertRationalLatLonToInt(
							localBundle.getString("GPSLongitude"),
							localBundle.getString("GPSLongitudeRef"));
			if ((localFootprint.mLatitude != 0)
					|| (localFootprint.mLongitude != 0))
				localFootprint.mAccuracy = 2;
			localFootprint.setAudio(null);
		}
	}

	private void showBalloon() {
		this.mMap.removeView(this.mBalloonView);
		if (this.mFootprint.mAccuracy > 0)
			this.mMap.addView(this.mBalloonView, new MapView.LayoutParams(40,
					40, this.mFootprint.getPoint(), 81));
		this.mMap.invalidate();
	}

	
	private void showToast(String paramString) {
		if (paramString != null)
			Toast.makeText(this, paramString, 3000).show();
	}

	private void unbindLocationAgentService(boolean paramBoolean) {
		Log.i("FootprintDetailEditActivity",
				"unbind LocationAgentService. mBindState = " + this.mBindState);
		if (this.mBindState == 1) {
			Log.d("FootprintDetailEditActivity",
					"LocationAgentService is still in binding. but user call unbind");
			innerUnbindLocationAgentService(paramBoolean);
		}
		while (true) {
			return;
			if (this.mBindState == 2) {
				innerUnbindLocationAgentService(paramBoolean);
				continue;
			}
			if (this.mBindState != 0)
				continue;
			Log.d("FootprintDetailEditActivity",
					"LocationAgentService is not bind. but user call unbind");
		}
	}

	protected boolean isRouteDisplayed() {
		return false;
	}

	protected void onActivityResult(int paramInt1, int paramInt2,
			Intent paramIntent) {
		if (paramInt1 == 1)
			this.isPickerRunning = false;
		while (true) {
			try {
				if (this.mService == null)
					continue;
				this.mService.setTimeoutNotify(true);
				if (paramInt2 != -1)
					return;
			} catch (RemoteException localRemoteException1) {
				localRemoteException1.printStackTrace();
				continue;
				if (paramIntent == null)
					continue;
				double d3 = paramIntent.getDoubleExtra("RETURN_LATITUDE", 0.0D);
				double d4 = paramIntent
						.getDoubleExtra("RETURN_LONGITUDE", 0.0D);
				paramIntent.getIntExtra("RETURN_ZOOM", 2);
				paramIntent.getStringExtra("RETURN_URL");
				Log.i("FootprintDetailEditActivity", "picker latitude = " + d3);
				Log.i("FootprintDetailEditActivity", "picker longitude = " + d4);
				if (this.mFootprint == null)
					continue;
				this.mFootprint.mLatitude = (int) (1000000.0D * d3);
				this.mFootprint.mLongitude = (int) (1000000.0D * d4);
				this.mFootprint.setAccuracyByProvider("map");
				Location localLocation = new Location("map");
				localLocation.setTime(System.currentTimeMillis());
				localLocation.setLatitude(d3);
				localLocation.setLongitude(d4);
				this.mFixLocation = localLocation;
				this.mHandler.sendEmptyMessageDelayed(102, 300L);
				this.mTextLatLon.setText(FootprintUtils
						.getFormatedLat(this.mFootprint.mLatitude)
						+ ", "
						+ FootprintUtils
								.getFormatedLon(this.mFootprint.mLongitude));
				moveMapCenterToCurrent();
				try {
					if (this.mService == null)
						continue;
					this.mService.stopTracking();
				} catch (RemoteException localRemoteException2) {
					localRemoteException2.printStackTrace();
				}
				continue;
			}
			if (paramInt1 == 3) {
				this.isRecaptureRunning = false;
				if (paramInt2 != -1)
					continue;
				String str = paramIntent.getStringExtra("EXTRA_PHOTO_PATH");
				this.photoView.getBackground().setCallback(null);
				this.photoView.setBackgroundDrawable(Drawable
						.createFromPath(str));
				if ((str != null) && (str.length() > 0))
					;
				for (this.mFootprint.mPicPath = str;; this.mFootprint.mPicPath = "") {
					this.mFootprint.mPicFileName = new File(
							this.mFootprint.mPicPath).getName();
					break;
				}
			}
			if (paramInt1 == 2) {
				if (paramInt2 != -1)
					continue;
				this.mPhotoBitmap = ((Bitmap) paramIntent
						.getParcelableExtra("data"));
				if (this.mPhotoBitmap == null)
					continue;
				this.photoView.setBackgroundDrawable(new BitmapDrawable(
						this.mPhotoBitmap));
				continue;
			}
			if ((paramInt1 != 5) || (paramInt2 != -1) || (paramIntent == null))
				continue;
			double d1 = paramIntent.getDoubleExtra("RETURN_LATITUDE", 0.0D);
			double d2 = paramIntent.getDoubleExtra("RETURN_LONGITUDE", 0.0D);
			if (this.mFootprint == null)
				continue;
			this.mFootprint.mAccuracy = 2;
			this.mFootprint.mLatitude = (int) (1000000.0D * d1);
			this.mFootprint.mLongitude = (int) (1000000.0D * d2);
			this.mFixLocation = new Location("gps");
			this.mFixLocation.setLatitude(d1);
			this.mFixLocation.setLongitude(d2);
			this.mHandler.sendEmptyMessageDelayed(102, 300L);
			this.mTextLatLon
					.setText(FootprintUtils
							.getFormatedLat(this.mFootprint.mLatitude)
							+ ", "
							+ FootprintUtils
									.getFormatedLon(this.mFootprint.mLongitude));
			moveMapCenterToCurrent();
		}
	}

	public void onClick(View paramView) {
		if (paramView == this.saveButton) {
			saveFootprint();
			Intent localIntent = new Intent();
			localIntent.putExtra("DATA", this.mFootprint);
			setResult(-1, localIntent);
		}
		try {
			if (this.mService != null)
				this.mService.stopTrackingWithoutNotify();
			finish();
			return;
		} catch (RemoteException localRemoteException) {
			while (true)
				localRemoteException.printStackTrace();
		}
	}

	protected void onCreate(Bundle paramBundle) {
		super.onCreate(paramBundle);
		this.mContext = this;
		requestWindowFeature(1);
		setVolumeControlStream(3);
		this.networkConnected = checkWirelessNetwork();
		if ((SettingInfo.getInstance(this).showConnectionFailedAlert)
				&& (!this.networkConnected))
			showDialog(19);
		setContentView(2130903054);
		Intent localIntent = getIntent();
		if (isSetasFootprints(localIntent)) {
			this.mFootprint = setAsFootprint(localIntent);
			this.titleText = ((EditText) findViewById(2131492892));
			this.titleText.requestFocus();
			this.phoneText = ((TextView) findViewById(2131492921));
			this.phoneText.setInputType(3);
			this.webText = ((TextView) findViewById(2131492925));
			this.webText.setInputType(2369);
			this.addressText = ((TextView) findViewById(2131492901));
			this.addressText.setInputType(8305);
			this.photoView = ((ImageView) findViewById(2131492906));
			this.photoView.setOnClickListener(this.mChoosePhotoCb);
			this.rating = ((RatingBar) findViewById(2131492908));
			this.rating.setStepSize(1.0F);
			this.textNote = ((TextView) findViewById(2131492936));
			this.categoryButton = ((Button) findViewById(2131492957));
			this.categoryButton
					.setOnClickListener(this.mSelectCategoryListener);
			this.mMediaPanel = ((MediaControlPanelEditMode) findViewById(2131492958));
			this.mMap = ((MapView) findViewById(2131492962));
			this.mMap.getController().setCenter(this.mFootprint.getPoint());
			if (this.mFootprint.mAccuracy == 0)
				break label594;
			this.mMap.getController().setZoom(17);
		}
		while (true) {
			this.mBalloonView = new ImageView(this);
			this.mBalloonView.setImageResource(2130837655);
			showBalloon();
			new Handler().postDelayed(new Runnable() {
				public void run() {
					FootprintDetailEditActivity.this.openMapView();
				}
			}, 200L);
			this.saveButton = findViewById(2131492964);
			this.saveButton.setOnClickListener(this);
			this.locationText = ((TextView) findViewById(2131492959));
			this.mTextLatLon = ((TextView) findViewById(2131492960));
			this.mGpsUpdate = ((ImageView) findViewById(2131492961));
			this.mTextLatLon.setOnClickListener(this.onTextLatLonClickListener);
			initCategoryData();
			this.mStorageUtil = new StorageUtil(getApplicationContext());
			this.mStorageUtil
					.SetOnChangeStorageListerner(new StorageUtil.OnChangeStorageListener() {
						public void onStorageChanged(int paramInt) {
							if (paramInt > 1)
								FootprintDetailEditActivity.this
										.startActivity(FootprintUtils
												.getResetIntent());
						}
					});
			this.gpsEnabled = ((LocationManager) getSystemService("location"))
					.isProviderEnabled("gps");
			if (this.gpsEnabled) {
				Log.d("FootprintDetailEditActivity",
						"onCreate. call bind service");
				bindLocationAgentService();
			}
			this.mCacheLat = this.mFootprint.mLatitude;
			this.mCacheLog = this.mFootprint.mLongitude;
			this.mCachePhotoName = this.mFootprint.mPicFileName;
			this.mHandler.postDelayed(new Runnable(localIntent) {
				public void run() {
					if ((FootprintDetailEditActivity.this.mFootprint.mPicPath != null)
							&& (FootprintDetailEditActivity.this.mFootprint.mPicPath
									.length() > 0)) {
						Bitmap localBitmap = FootprintImageManager
								.getInstance()
								.getScaledImage(
										new File(
												FootprintDetailEditActivity.this.mFootprint.mPicPath),
										FootprintDetailEditActivity.this, 120,
										120, true);
						FootprintDetailEditActivity.this.photoView
								.setBackgroundDrawable(new BitmapDrawable(
										localBitmap));
					}
					if ((FootprintDetailEditActivity.this
							.isSetasFootprints(this.val$activityIntent))
							&& (FootprintDetailEditActivity.this.mPhotoBitmap != null)
							&& (FootprintDetailEditActivity.this.mPhotoBitmap
									.getHeight() > 0)
							&& (FootprintDetailEditActivity.this.mPhotoBitmap
									.getWidth() > 0))
						FootprintDetailEditActivity.this.photoView
								.setBackgroundDrawable(new BitmapDrawable(
										FootprintDetailEditActivity.this.mPhotoBitmap));
					FootprintDetailEditActivity.access$502(
							FootprintDetailEditActivity.this,
							(TextView) FootprintDetailEditActivity.this
									.findViewById(2131492913));
					FootprintDetailEditActivity.access$602(
							FootprintDetailEditActivity.this,
							(TextView) FootprintDetailEditActivity.this
									.findViewById(2131492914));
					java.text.DateFormat localDateFormat1 = android.text.format.DateFormat
							.getDateFormat(FootprintDetailEditActivity.this
									.getApplicationContext());
					FootprintDetailEditActivity.this.textCreateDate
							.setText(localDateFormat1
									.format(new Date(
											FootprintDetailEditActivity.this.mFootprint.mCreateTime)));
					java.text.DateFormat localDateFormat2 = android.text.format.DateFormat
							.getTimeFormat(FootprintDetailEditActivity.this
									.getApplicationContext());
					FootprintDetailEditActivity.this.textCreateTime
							.setText(localDateFormat2
									.format(new Date(
											FootprintDetailEditActivity.this.mFootprint.mCreateTime)));
					FootprintDetailEditActivity.this.textNote
							.setText(FootprintDetailEditActivity.this.mFootprint.mComment);
					FootprintDetailEditActivity.this.populateFootprintToView();
				}
			}, 50L);
			return;
			this.mFootprint = ((Footprint) localIntent
					.getParcelableExtra("DATA"));
			break;
			label594: this.mMap.getController().setZoom(2);
		}
	}

	protected Dialog onCreateDialog(int paramInt) {
		Object localObject;
		switch (paramInt) {
		default:
			localObject = super.onCreateDialog(paramInt);
		case 10:
		case 11:
		case 12:
		case 13:
		case 14:
		case 15:
		case 16:
		case 17:
		case 18:
		case 19:
		}
		while (true) {
			return localObject;
			localObject = new HtcAlertDialog.Builder(this)
					.setTitle(2131361911)
					.setIcon(2130837677)
					.setItems(getResources().getStringArray(2131165184),
							new DialogInterface.OnClickListener() {
								public void onClick(
										DialogInterface paramDialogInterface,
										int paramInt) {
									switch (paramInt) {
									default:
									case 0:
									case 1:
									}
									while (true) {
										paramDialogInterface.dismiss();
										return;
										FootprintDetailEditActivity.this
												.doPickPhotoAction();
										continue;
										Intent localIntent = new Intent(
												FootprintDetailEditActivity.this,
												FootprintCamera.class);
										localIntent.putExtra("recapture", 1);
										FootprintDetailEditActivity.this.locationText
												.setText(2131361852);
										FootprintDetailEditActivity
												.access$1902(
														FootprintDetailEditActivity.this,
														true);
										FootprintDetailEditActivity.this
												.startActivityForResult(
														localIntent, 3);
									}
								}
							}).create();
			continue;
			localObject = new HtcAlertDialog.Builder(this)
					.setTitle(2131361956)
					.setIcon(2130837677)
					.setNegativeButton(2131361796, null)
					.setSingleChoiceItems(this.categoryNames,
							this.categoryIndex,
							new DialogInterface.OnClickListener() {
								public void onClick(
										DialogInterface paramDialogInterface,
										int paramInt) {
									Category localCategory = (Category) FootprintDetailEditActivity.this.categories
											.get(paramInt);
									FootprintDetailEditActivity.this.mFootprint.mCategory = localCategory.mKeyword;
									FootprintDetailEditActivity.this.categoryButton
											.setText(localCategory.mName);
									FootprintDetailEditActivity.access$2202(
											FootprintDetailEditActivity.this,
											paramInt);
									paramDialogInterface.dismiss();
								}
							}).create();
			continue;
			try {
				this.mService.setTimeoutNotify(false);
				this.mListDialog = new HtcAlertDialog.Builder(this)
						.setTitle(2131361860)
						.setIcon(2130837677)
						.setItems(getResources().getStringArray(2131165186),
								new DialogInterface.OnClickListener() {
									public void onClick(
											DialogInterface paramDialogInterface,
											int paramInt) {
										switch (paramInt) {
										default:
										case 0:
										case 1:
										case 2:
										}
										while (true) {
											paramDialogInterface.dismiss();
											return;
											FootprintDetailEditActivity.this
													.getWindow()
													.clearFlags(128);
											Intent localIntent = new Intent(
													"com.htc.android.locationpicker");
											localIntent
													.putExtra(
															"PickerIcon",
															((BitmapDrawable) FootprintDetailEditActivity.this
																	.getResources()
																	.getDrawable(
																			2130837655))
																	.getBitmap());
											if ((FootprintDetailEditActivity.this.mFootprint.mLatitude == 0)
													&& (FootprintDetailEditActivity.this.mFootprint.mLongitude == 0))
												if (FootprintDetailEditActivity.this.mFixNetwork != null) {
													localIntent
															.putExtra(
																	"PickerLatitude",
																	FootprintDetailEditActivity.this.mFixNetwork
																			.getLatitude());
													localIntent
															.putExtra(
																	"PickerLongitude",
																	FootprintDetailEditActivity.this.mFixNetwork
																			.getLongitude());
													label157: localIntent
															.putExtra(
																	"PickerMode",
																	1);
													localIntent.putExtra(
															"PickerPanelStyle",
															8);
													localIntent
															.putExtra(
																	"PickerHintFlag",
																	5);
													localIntent
															.putExtra(
																	"PickerHintMsg",
																	FootprintDetailEditActivity.this.mFootprint.mName);
													localIntent.putExtra(
															"PickerReturnType",
															9);
													localIntent
															.putExtra(
																	"PickerAlertConnectionFailed",
																	SettingInfo
																			.getInstance(FootprintDetailEditActivity.this).showConnectionFailedAlert);
													FootprintDetailEditActivity.this.locationText
															.setText(2131361852);
													FootprintDetailEditActivity.this.mGpsUpdate
															.setEnabled(true);
													try {
														FootprintDetailEditActivity
																.access$1702(
																		FootprintDetailEditActivity.this,
																		true);
														FootprintDetailEditActivity.this
																.startActivityForResult(
																		localIntent,
																		1);
													} catch (ActivityNotFoundException localActivityNotFoundException) {
													}
												}
											try {
												FootprintDetailEditActivity.this.mService
														.stopTracking();
												FootprintDetailEditActivity.this.mService
														.setTimeoutNotify(true);
												FootprintDetailEditActivity.this
														.showDialog(16);
												continue;
												localIntent.putExtra(
														"InputLocation", 4);
												break label157;
												localIntent
														.putExtra(
																"PickerLatitude",
																FootprintDetailEditActivity.this.mFootprint.mLatitude / 1000000.0D);
												localIntent
														.putExtra(
																"PickerLongitude",
																FootprintDetailEditActivity.this.mFootprint.mLongitude / 1000000.0D);
												localIntent.putExtra(
														"InputLocation", 3);
											} catch (RemoteException localRemoteException3) {
												while (true)
													localRemoteException3
															.printStackTrace();
											}
											FootprintDetailEditActivity.this.locationText
													.setText(2131361853);
											try {
												FootprintDetailEditActivity.this.mService
														.continueTracking();
												FootprintDetailEditActivity.this.mService
														.setTimeoutNotify(true);
											} catch (RemoteException localRemoteException2) {
												localRemoteException2
														.printStackTrace();
											}
											continue;
											FootprintDetailEditActivity.this
													.getWindow()
													.clearFlags(128);
											FootprintDetailEditActivity.this.mGpsUpdate
													.setEnabled(true);
											try {
												FootprintDetailEditActivity.this.mService
														.stopTracking();
												FootprintDetailEditActivity.this.mService
														.setTimeoutNotify(true);
												FootprintDetailEditActivity.this.locationText
														.setText(2131361852);
											} catch (RemoteException localRemoteException1) {
												while (true)
													localRemoteException1
															.printStackTrace();
											}
										}
									}
								}).create();
				this.mListDialog.setOnKeyListener(this.dlgKeyListener);
				localObject = this.mListDialog;
			} catch (RemoteException localRemoteException) {
				while (true)
					localRemoteException.printStackTrace();
			}
			localObject = new HtcAlertDialog.Builder(this)
					.setTitle(getString(2131361946)).setIcon(17301543)
					.setMessage(getString(2131361948))
					.setNeutralButton(2131361893, null).create();
			continue;
			this.progressDialog = new ProgressDialog(this);
			this.progressDialog
					.setMessage(getResources().getString(2131361964));
			this.progressDialog.setIndeterminate(true);
			this.progressDialog.setCancelable(true);
			this.progressDialog.setOnKeyListener(this.dlgKeyListener);
			localObject = this.progressDialog;
			continue;
			HtcAlertDialog.Builder localBuilder = new HtcAlertDialog.Builder(
					this).setTitle(getString(2131361957)).setIcon(17301543);
			String str = getString(2131361816);
			Object[] arrayOfObject = new Object[1];
			arrayOfObject[0] = this.mFootprint.mName;
			localObject = localBuilder
					.setMessage(String.format(str, arrayOfObject))
					.setPositiveButton(2131361893,
							new DialogInterface.OnClickListener() {
								public void onClick(
										DialogInterface paramDialogInterface,
										int paramInt) {
									FootprintDetailEditActivity.access$2502(
											FootprintDetailEditActivity.this,
											true);
									paramDialogInterface.dismiss();
									if (FootprintDetailEditActivity.this.mService != null)
										;
									try {
										FootprintDetailEditActivity.this.mService
												.stopTrackingWithoutNotify();
										FootprintUtils
												.deleteFootprint(
														FootprintDetailEditActivity.this
																.getApplicationContext(),
														FootprintDetailEditActivity.this.mFootprint);
										Intent localIntent = new Intent();
										localIntent.putExtra(
												"EXTRA_DELETE_FROM_EDIT", true);
										FootprintDetailEditActivity.this
												.setResult(-1, localIntent);
										FootprintDetailEditActivity.this
												.finish();
										return;
									} catch (RemoteException localRemoteException) {
										while (true)
											localRemoteException
													.printStackTrace();
									}
								}
							}).setNegativeButton(2131361796, null).create();
			continue;
			localObject = new HtcDialog(this).getLocationPickerNotFoundDialog();
			continue;
			localObject = new HtcDialog(this).getPhotoPickerNotFoundDialog();
			continue;
			localObject = new HtcAlertDialog.Builder(this)
					.setTitle(getString(2131361812))
					.setIcon(17301543)
					.setMessage(getString(2131361941))
					.setPositiveButton(2131361949,
							new DialogInterface.OnClickListener() {
								public void onClick(
										DialogInterface paramDialogInterface,
										int paramInt) {
									FootprintDetailEditActivity.access$2602(
											FootprintDetailEditActivity.this,
											true);
									Intent localIntent = new Intent(
											"android.settings.LOCATION_SOURCE_SETTINGS");
									paramDialogInterface.dismiss();
									FootprintDetailEditActivity.this
											.startActivity(localIntent);
								}
							}).setNegativeButton(2131361796, null).create();
			continue;
			localObject = new HtcDialog(this).getWirelessDisabledDialog();
		}
	}

	public boolean onCreateOptionsMenu(Menu paramMenu) {
		paramMenu.add(0, 0, 0, getString(2131361881)).setIcon(2130837728);
		paramMenu.add(0, 1, 1, getResources().getString(2131361808)).setIcon(
				2130837678);
		return true;
	}

	protected void onDestroy() {
		Log.d("FootprintDetailEditActivity", "onDestroy");
		if (!this.isDelete)
			saveFootprint();
		removeQueuedMessages();
		unbindLocationAgentService(false);
		if (this.categories != null)
			this.categories.clear();
		this.categories = null;
		this.categoryNames = null;
		super.onDestroy();
	}

	public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent) {
		if (paramInt == 4) {
			Log.i("FootprintDetailEditActivity", "onKeyDown");
			saveFootprint();
			if (this.mService == null)
				;
		}
		try {
			this.mService.stopTrackingWithoutNotify();
			Intent localIntent = new Intent();
			localIntent.putExtra("DATA", this.mFootprint);
			localIntent.putExtra("EDIT_TO_DETAIL", true);
			setResult(-1, localIntent);
			return super.onKeyDown(paramInt, paramKeyEvent);
		} catch (RemoteException localRemoteException) {
			while (true)
				localRemoteException.printStackTrace();
		}
	}

	public boolean onOptionsItemSelected(MenuItem paramMenuItem) {
		int i = paramMenuItem.getItemId();
		if (i == 0)
			if (this.mService == null)
				;
		while (true) {
			try {
				this.mService.stopTrackingWithoutNotify();
				startActivity(FootprintUtils.getResetIntent());
				return false;
			} catch (RemoteException localRemoteException) {
				localRemoteException.printStackTrace();
				continue;
			}
			if (i != 1)
				continue;
			showDialog(15);
		}
	}

	protected void onPause() {
		Log.d("FootprintDetailEditActivity", "onPause");
		super.onPause();
		if (this.mMediaPanel != null)
			this.mMediaPanel.stopMediaControlPanel();
		if ((this.mService != null) && (!this.isPickerRunning)
				&& (!this.isRecaptureRunning))
			;
		try {
			this.mService.waitForPause();
			if (this.mStorageUtil != null)
				this.mStorageUtil.closeStorgaeUtil();
			TitleGenerator.getInstance(this).stopTitleSearch();
			return;
		} catch (RemoteException localRemoteException) {
			while (true)
				localRemoteException.printStackTrace();
		}
	}

	protected void onRestoreInstanceState(Bundle paramBundle) {
		if (paramBundle.getParcelable("footprint") != null) {
			this.mFootprint = ((Footprint) paramBundle
					.getParcelable("footprint"));
			populateFootprintToView();
		}
	}

	// ERROR //
	protected void onResume() {
		// Byte code:
		// 0: invokestatic 1307
		// com/htc/android/footprints/utils/FootprintUtils:isResetByWidget ()Z
		// 3: ifeq +32 -> 35
		// 6: new 353 android/content/Intent
		// 9: dup
		// 10: aload_0
		// 11: ldc_w 1309
		// 14: invokespecial 1312 android/content/Intent:<init>
		// (Landroid/content/Context;Ljava/lang/Class;)V
		// 17: astore_1
		// 18: aload_1
		// 19: ldc_w 1313
		// 22: invokevirtual 1317 android/content/Intent:setFlags
		// (I)Landroid/content/Intent;
		// 25: pop
		// 26: aload_0
		// 27: aload_1
		// 28: invokevirtual 1282
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:startActivity
		// (Landroid/content/Intent;)V
		// 31: aload_0
		// 32: invokevirtual 1022
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:finish
		// ()V
		// 35: aload_0
		// 36: aload_0
		// 37: ldc_w 1116
		// 40: invokevirtual 372
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:getSystemService
		// (Ljava/lang/String;)Ljava/lang/Object;
		// 43: checkcast 1118 android/location/LocationManager
		// 46: ldc_w 447
		// 49: invokevirtual 1121
		// android/location/LocationManager:isProviderEnabled
		// (Ljava/lang/String;)Z
		// 52: putfield 321
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:gpsEnabled
		// Z
		// 55: aload_0
		// 56: getfield 321
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:gpsEnabled
		// Z
		// 59: ifne +147 -> 206
		// 62: aload_0
		// 63: getfield 296
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mGpsUpdate
		// Landroid/widget/ImageView;
		// 66: aload_0
		// 67: getfield 232
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:onGpsUpdateClickListenerShowAlert
		// Landroid/view/View$OnClickListener;
		// 70: invokevirtual 1063 android/widget/ImageView:setOnClickListener
		// (Landroid/view/View$OnClickListener;)V
		// 73: aload_0
		// 74: getfield 185
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:gpsUpdateRequired
		// Z
		// 77: ifeq +8 -> 85
		// 80: aload_0
		// 81: iconst_0
		// 82: putfield 185
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:gpsUpdateRequired
		// Z
		// 85: aload_0
		// 86: getfield 524
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mService
		// Lcom/htc/android/footprints/ILocationAgentService;
		// 89: ifnull +141 -> 230
		// 92: ldc 97
		// 94: ldc_w 1319
		// 97: invokestatic 460 android/util/Log:d
		// (Ljava/lang/String;Ljava/lang/String;)I
		// 100: pop
		// 101: aload_0
		// 102: getfield 524
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mService
		// Lcom/htc/android/footprints/ILocationAgentService;
		// 105: invokeinterface 1322 1 0
		// 110: aload_0
		// 111: getfield 524
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mService
		// Lcom/htc/android/footprints/ILocationAgentService;
		// 114: invokeinterface 1325 1 0
		// 119: ifeq +9 -> 128
		// 122: aload_0
		// 123: bipush 12
		// 125: invokevirtual 433
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:showDialog
		// (I)V
		// 128: aload_0
		// 129: aload_0
		// 130: invokespecial 1037
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:checkWirelessNetwork
		// ()Z
		// 133: putfield 676
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:networkConnected
		// Z
		// 136: aload_0
		// 137: getfield 191
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:connectionFailedText
		// Landroid/widget/TextView;
		// 140: ifnull +26 -> 166
		// 143: aload_0
		// 144: getfield 676
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:networkConnected
		// Z
		// 147: ifeq +19 -> 166
		// 150: aload_0
		// 151: getfield 567
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mMap
		// Lcom/google/android/maps/MapView;
		// 154: aload_0
		// 155: getfield 191
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:connectionFailedText
		// Landroid/widget/TextView;
		// 158: invokevirtual 863 com/google/android/maps/MapView:removeView
		// (Landroid/view/View;)V
		// 161: aload_0
		// 162: aconst_null
		// 163: putfield 191
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:connectionFailedText
		// Landroid/widget/TextView;
		// 166: aload_0
		// 167: getfield 1109
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mStorageUtil
		// Lcom/htc/android/footprints/utils/StorageUtil;
		// 170: ifnull +10 -> 180
		// 173: aload_0
		// 174: getfield 1109
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mStorageUtil
		// Lcom/htc/android/footprints/utils/StorageUtil;
		// 177: invokevirtual 1328
		// com/htc/android/footprints/utils/StorageUtil:startStorageUtil ()V
		// 180: aload_0
		// 181: invokespecial 1330 com/google/android/maps/MapActivity:onResume
		// ()V
		// 184: aload_0
		// 185: getfield 1048
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:titleText
		// Landroid/widget/EditText;
		// 188: invokevirtual 1333 android/widget/EditText:hasFocus ()Z
		// 191: ifeq +14 -> 205
		// 194: aload_0
		// 195: invokestatic 1338
		// com/htc/android/footprints/utils/ImeLauncher:getInstance
		// (Landroid/content/Context;)Lcom/htc/android/footprints/utils/ImeLauncher;
		// 198: aload_0
		// 199: getfield 1048
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:titleText
		// Landroid/widget/EditText;
		// 202: invokevirtual 1341
		// com/htc/android/footprints/utils/ImeLauncher:show
		// (Landroid/widget/EditText;)V
		// 205: return
		// 206: aload_0
		// 207: getfield 296
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mGpsUpdate
		// Landroid/widget/ImageView;
		// 210: aload_0
		// 211: getfield 235
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:onGpsUpdateClickListenerDoUpdate
		// Landroid/view/View$OnClickListener;
		// 214: invokevirtual 1063 android/widget/ImageView:setOnClickListener
		// (Landroid/view/View$OnClickListener;)V
		// 217: goto -132 -> 85
		// 220: astore 5
		// 222: aload 5
		// 224: invokevirtual 541 android/os/RemoteException:printStackTrace ()V
		// 227: goto -99 -> 128
		// 230: aload_0
		// 231: getfield 203
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:mBindState
		// I
		// 234: ifne -106 -> 128
		// 237: aload_0
		// 238: getfield 321
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:gpsEnabled
		// Z
		// 241: ifeq -113 -> 128
		// 244: aload_0
		// 245: invokespecial 1125
		// com/htc/android/footprints/activity/FootprintDetailEditActivity:bindLocationAgentService
		// ()V
		// 248: goto -120 -> 128
		// 251: astore_3
		// 252: ldc 97
		// 254: ldc_w 1343
		// 257: invokestatic 460 android/util/Log:d
		// (Ljava/lang/String;Ljava/lang/String;)I
		// 260: pop
		// 261: goto -77 -> 184
		//
		// Exception table:
		// from to target type
		// 92 128 220 android/os/RemoteException
		// 180 184 251 java/lang/Exception
	}

	protected void onSaveInstanceState(Bundle paramBundle) {
		if (this.mFootprint != null) {
			populateToFootprint();
			paramBundle.putParcelable("footprint", this.mFootprint);
		}
	}

	protected void onStart() {
		super.onStart();
	}

	protected void onStop() {
		super.onStop();
	}

	public void populateFootprintToView() {
		this.titleText.setText(this.mFootprint.mName);
		if (this.titleText.isFocused())
			this.titleText.setSelection(this.titleText.getText().length());
		this.addressText.setText(this.mFootprint.mAddr);
		this.phoneText.setText(this.mFootprint.mTel);
		this.webText.setText(this.mFootprint.mSite);
		this.rating.setRating(this.mFootprint.mRate);
		this.categoryButton
				.setText(getOriginalCategoryNameAndRecordIndex(this.mFootprint.mCategory));
		this.mMediaPanel.setFootprintData(this.mFootprint);
		if (this.mFootprint.mAccuracy != 0)
			this.mTextLatLon
					.setText(FootprintUtils
							.getFormatedLat(this.mFootprint.mLatitude)
							+ ", "
							+ FootprintUtils
									.getFormatedLon(this.mFootprint.mLongitude));
	}

	public void populateToFootprint() {
		this.mFootprint.mAddr = this.addressText.getText().toString();
		this.mFootprint.mTel = this.phoneText.getText().toString();
		this.mFootprint.mName = this.titleText.getText().toString();
		this.mFootprint.mSite = this.webText.getText().toString();
		this.mFootprint.mRate = (int) this.rating.getRating();
		this.mFootprint.mComment = this.textNote.getText().toString();
	}

	public void selectImage(Context paramContext, int paramInt) {
		selectMediaByType(paramContext, paramInt, "image/*");
	}
}

/*
 * Location:
 * E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:
 * com.htc.android.footprints.activity.FootprintDetailEditActivity JD-Core
 * Version: 0.6.0
 */